{extend name="index_layout"/}
{block name="main"}
<div class="layui-card layer-popup">
    <div class="layui-card-body">
        <div class="admin-main layui-anim layui-anim-upbit">

            <form class="layui-form layui-form-pane" lay-filter="form">
                <div class="layui-form-item">
                    <label class="layui-form-label">公告标题</label>
                    <div class="layui-input-inline">
                        <input type="text" name="title" lay-verify="required" placeholder="{:lang('pleaseEnter')}公告标题" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        在4到25个字符之间。
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">标题颜色</label>
                    <div class="layui-input-inline">
                        <input type="hidden" name="color" value="" id="icon-colorpicker-all-input">
                        <div id="icon-colorpicker-color"></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">描述</label>
                    <div class="layui-input-inline">
                        <textarea name="description" placeholder="描述" class="layui-textarea"></textarea>
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        描述
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">内容</label>
                    <div class="layui-input-inline border-none">
                        <script type="text/plain" class="js-ueditor" id="content" name="content" lay-verify="required" lay-reqText="内容不能为空" >{if $info}{$info['content']|raw}{/if}</script>
                    </div>
                </div>

                <div class="layui-form-item" pane>
                    <label class="layui-form-label">状态</label>
                    <div class="layui-input-inline">
                        <input type="radio" name="status" lay-filter="status" checked value="1" title="开启">
                        <input type="radio" name="status" lay-filter="status" value="0" title="关闭">
                    </div>
                </div>

                <div class="layui-form-item layer-footer">
                    <div>
                        <input type="hidden" name="id">
                        <button type="button" class="layui-btn" lay-submit="" lay-filter="submit"><i class="layui-icon layui-icon-form"></i> {:lang('submit')}</button>
                        <button type="reset" class="layui-btn layui-btn-primary"> <i class="layui-icon layui-icon-delete"></i>{:lang('reset')}</button>
                    </div>
                </div>
            </form>
        </div>

    </div>
</div>
{/block}
{block name="script"}
<script>
    layui.use(['Admin','laydate','form','colorpicker'], function() {
        var form = layui.form,
            layer = layui.layer,
            colorpicker = layui.colorpicker,
            $= layui.jquery;
        var info = '';
        info = {:json_encode($info)};
        form.val("form", info);
        if(info){
            $('#addPic').attr('src',info.avatar);
        }
        form.render();

        //开启全功能
        colorpicker.render({
            elem: '#icon-colorpicker-color'
            ,color: '{if $info}{$info["color"]}{/if}'
            ,format: 'rgb'
            ,predefine: true
            ,alpha: true
            ,done: function(color){
                $('#icon-colorpicker-all-input').val(color); //向隐藏域赋值
                layer.tips('给图标设置了颜色值：'+ color, this.elem);

                color || this.change(color); //清空时执行 change
            }
            ,change: function(color){

            }
        });

    });
</script>
{/block}